package cl.crabcom.accessdata;

import static android.provider.BaseColumns._ID;
import static cl.crabcom.accessdata.Constants.NAME;
import static cl.crabcom.accessdata.Constants.TABLE_NAME;
import static cl.crabcom.accessdata.Constants.TIME;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MarketData extends SQLiteOpenHelper {
	
	private static final String DATABASE_NAME = "shopping.db";
	private static final int DATABASE_VERSION = 1;

	/** Create a helper object for the Events database */
	public MarketData(Context ctx) {
		super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		
		//String createTable = "CREATE TABLE market ( id interger.., time..., name...)";
		
		db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
				+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + TIME + " INTEGER,"
				+ NAME + " TEXT NOT NULL);");
		
		
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(db);
	}
}